package com.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.entity.Manager;
import com.demo.mapper.ManagerMapper;
import com.demo.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerMapper, Manager> implements ManagerService {
    private ManagerMapper managerMapper;
    @Autowired
    public void setManagerMapper(ManagerMapper managerMapper) {
        this.managerMapper = managerMapper;
    }
    public int login(Manager manager) {//0:账户不存在 1:登录成功 2:密码错误
        Manager managerDB = managerMapper.selectByUsername(manager.getUsername());
        if (managerDB==null) return 0;
        if (managerDB.getPassword().equals(manager.getPassword())) return 1;
        return 2;
    }



}
